<?php

namespace App\Http\Controllers;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;


class UploadController extends BaseController
{
    public function index(Request $request)
    {
        $param = $this->validate($request,[
            'image' => 'required'
        ]);

        $image = $param['image'];

        if ($image->isValid()){
            $path = $image->store('images','oss');
            return $this->success(['url' => 'https://huashimu.oss-cn-beijing.aliyuncs.com/'.$path]);
        }

        return  $this->error();
    }
}
